#include "DataType.h"
#include <QAtomicInt>

//UpperComputerType g_UCTtype = UpperComputerType::Type_20KW;
//// 定义一个QAtomicInt实例作为原子锁
//QAtomicInt atomicLock;
#include <QDebug>

DataType::DataType(QObject *parent) : QObject(parent)
{

}



WriteData::WriteData(int startAddress, int registerCount, QList<quint16> data)
    :m_StartAddress(startAddress),m_RegisterCount(registerCount),m_Data(data)
{
    if(registerCount != data.size())
    {
        qDebug() << "WriteData 构造错误";
    }
}

IPAddressValidator::IPAddressValidator(QObject *parent): QRegExpValidator(parent)
{
    // 正则表达式用于匹配标准的 IPv4 地址
    QRegExp regex("\\b(?:[0-9]{1,3}\\.){3}[0-9]{1,3}\\b");
    setRegExp(regex);
}

QValidator::State IPAddressValidator::validate(QString &input, int &pos) const
{
    return QRegExpValidator::validate(input, pos);
}

